import heapq

def can_split(nums, m, target):
    if m == 0:
        return False
    sums = [0] * m
    heapq.heapify(sums)
    for num in nums:
        smallest = heapq.heappop(sums)
        heapq.heappush(sums, smallest + num)
    return all(s == target for s in sums)

def max_m_split(nums):
    total = sum(nums)
    if total == 0:
        return len(nums)  # If all zeros, can split into len(nums) parts
    max_num = max(nums)
    for target in range(max_num, total + 1):
        if total % target == 0:
            m = total // target
            if can_split(nums, m, target):
                return m
    return 1

# 测试用例
if __name__ == "__main__":    
    # 测试用例
    test_cases = [
        [6, 4, 3, 3, 2],
        [10, 8, 6, 4, 2],
        [7, 7, 7],
        [5, 4, 3, 2, 1],
        [5, 4, 3, 2],
    ]
    
    for i, test in enumerate(test_cases):
        print(f"测试用例 {i+1} {test}: 最大的m值为 {max_m_split(test)}")